package com.itCar.base.api.tacticsPaymentDemo;

import com.itCar.base.config.result.ResultBody;
import org.springframework.stereotype.Component;

/**
 * @ClassName AlPay
 * @Description TODO 支付宝支付方式
 * @Author liuzhiguo
 * @Date 2024/9/18 9:14
 * @Version 1.0
 */
@Component
public class AlPay implements Pay {
    @Override
    public ResultBody pay(Integer amount) {
        //实现满10减1
        double v = 0.0;
        if (amount >= 100) {
            int count = amount / 10;
            v = amount - count;
            System.out.println("支付宝支付" + v);
        } else {
            v = amount * 0.98;
            System.out.println("支付宝支付" + v);
        }
        return ResultBody.success("支付宝支付" + v);
    }
}
